import { KingCopyItemData } from "./info/KingCopyItemData";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { KingCopyPanel2 } from "./KingCopyPanel2";
import { ImagesConst } from "../../../resource/ImagesConst";
import { BitmapDataConst } from "../../../../common/display/BitmapDataConst";
import { ObjCreate } from "../../common/ObjCreate";
//class KingCopyItem
    
    export  class KingCopyItem /* flash.display.Sprite */
    {
        constructor(arg1: string)
        {
            
            this._position = arg1;
            this.createChildren();
            return;
        }

        public set data(arg1: KingCopyItemData)
        {
            if (arg1) 
            {
                if (this._position != KingCopyItem.LEFT) 
                {
                    if (this._position != KingCopyItem.CENTER) 
                    {
                        if (this._position == KingCopyItem.RIGHT) 
                        {
                            this._bgImg.bitmapData = GlobalClass.getBitmapData(KingCopyPanel2.RIGHT_NAME + arg1.index);
                            this._stateImg.bitmapData = GlobalClass.getBitmapData(this.STATE_NAME + arg1.copyState);
                        }
                    }
                    else 
                    {
                        this._bgImg.bitmapData = GlobalClass.getBitmapData(KingCopyPanel2.CENTER_NAME + arg1.index);
                        if (arg1.copyState > 0) 
                        {
                            this._killImg.bitmapData = GlobalClass.getBitmapData(ImagesConst.KingCopyKill);
                            this._stateImg.bitmapData = BitmapDataConst.AlphaBitmapData;
                        }
                        else 
                        {
                            this._killImg.bitmapData = BitmapDataConst.AlphaBitmapData;
                            this._stateImg.bitmapData = GlobalClass.getBitmapData(this.STATE_NAME + arg1.copyState);
                        }
                    }
                }
                else 
                {
                    this._bgImg.bitmapData = GlobalClass.getBitmapData(KingCopyPanel2.LEFT_NAME + arg1.index);
                    this._stateImg.bitmapData = GlobalClass.getBitmapData(this.STATE_NAME + arg1.copyState);
                    this._stateImg.y = 10;
                }
                this._stateImg.x = -5;
            }
            else 
            {
                this.cleanImg();
            }
            return;
        }

        /* internal  */createChildren(): void
        {
            this._bgImg = new Object /* flash.display.Bitmap */();
            ObjCreate.setObjAttri(this._bgImg, 0, 0, -1, -1, this);
            this._stateImg = new Object /* flash.display.Bitmap */();
            ObjCreate.setObjAttri(this._stateImg, 0, 0, -1, -1, this);
            this._killImg = new Object /* flash.display.Bitmap */();
            ObjCreate.setObjAttri(this._killImg, -10, -5, -1, -1, this);
            return;
        }

        /* internal  */cleanImg(): void
        {
            this._bgImg.bitmapData = BitmapDataConst.AlphaBitmapData;
            this._stateImg.bitmapData = BitmapDataConst.AlphaBitmapData;
            this._killImg.bitmapData = BitmapDataConst.AlphaBitmapData;
            return;
        }

        /* internal */ /* const */STATE_NAME: string="KingCopyState_";

        public static /* const */LEFT: string="Left";

        public static /* const */CENTER: string="Center";

        public static /* const */RIGHT: string="Right";

        /* internal */ /* var */_bgImg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_stateImg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_killImg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_position: string;
    }
